package com.googlecode.stemwijzer.rebind.util;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Locale;

/**
 * 
 * @author pascal.janssen
 * 
 */
public class GeneratorDebugProxyPrintWriter extends PrintWriter {

	private final PrintWriter debugWriter;

	public GeneratorDebugProxyPrintWriter(final PrintWriter proxifiedWriter, final File proxyOutput)
			throws FileNotFoundException {
		super(proxifiedWriter);

		this.debugWriter = new PrintWriter(new FileOutputStream(proxyOutput), true);
	}

	@Override
	public PrintWriter append(final char c) {
		this.debugWriter.append(c);
		return super.append(c);
	}

	@Override
	public PrintWriter append(final CharSequence csq) {
		this.debugWriter.append(csq);
		return super.append(csq);
	}

	@Override
	public PrintWriter append(final CharSequence csq, final int start, final int end) {
		this.debugWriter.append(csq, start, end);
		return super.append(csq, start, end);
	}

	@Override
	public boolean checkError() {
		this.debugWriter.checkError();
		return super.checkError();
	}

	@Override
	public void close() {
		this.debugWriter.close();
		super.close();
	}

	@Override
	public void flush() {
		this.debugWriter.flush();
		super.flush();
	}

	@Override
	public PrintWriter format(final Locale l, final String format, final Object... args) {
		this.debugWriter.format(l, format, args);
		return super.format(l, format, args);
	}

	@Override
	public PrintWriter format(final String format, final Object... args) {
		this.debugWriter.format(format, args);
		return super.format(format, args);
	}

	@Override
	public void print(final boolean b) {
		this.debugWriter.print(b);
		super.print(b);
	}

	@Override
	public void print(final char c) {
		this.debugWriter.print(c);
		super.print(c);
	}

	@Override
	public void print(final char[] s) {
		this.debugWriter.print(s);
		super.print(s);
	}

	@Override
	public void print(final double d) {
		this.debugWriter.print(d);
		super.print(d);
	}

	@Override
	public void print(final float f) {
		this.debugWriter.print(f);
		super.print(f);
	}

	@Override
	public void print(final int i) {
		this.debugWriter.print(i);
		super.print(i);
	}

	@Override
	public void print(final long l) {
		this.debugWriter.print(l);
		super.print(l);
	}

	@Override
	public void print(final Object obj) {
		this.debugWriter.print(obj);
		super.print(obj);
	}

	@Override
	public void print(final String s) {
		this.debugWriter.print(s);
		super.print(s);
	}

	@Override
	public PrintWriter printf(final Locale l, final String format, final Object... args) {
		this.debugWriter.printf(l, format, args);
		return super.printf(l, format, args);
	}

	@Override
	public PrintWriter printf(final String format, final Object... args) {
		this.debugWriter.printf(format, args);
		return super.printf(format, args);
	}

	@Override
	public void println() {
		this.debugWriter.println();
		super.println();
	}

	@Override
	public void println(final boolean x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final char x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final char[] x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final double x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final float x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final int x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final long x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final Object x) {
		this.debugWriter.println(x);
		super.println(x);
	}

	@Override
	public void println(final String x) {
		this.debugWriter.println(x);
		super.println(x);
	}

}
